import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'doufeng_tacit_model.dart';
import 'tacit_count_down_painter.dart';

class WaitingStartWidget extends StatefulWidget {
  // VoidCallback onEnd;
  // VoidCallback onCancel;
  //
  // InvitingRefuseWidget();

  @override
  State<WaitingStartWidget> createState() => _WaitingStartWidgetState();
}

class _WaitingStartWidgetState extends State<WaitingStartWidget>
    with TickerProviderStateMixin {
  @override
  Widget build(BuildContext context) {
    return Consumer<DoufengTacitModel>(builder: (context, model, child) {
      return Container(
        padding: const EdgeInsets.symmetric(
          horizontal: 34,
        ),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            SizedBox(
              height: 16,
              child: Stack(
                children: [
                  const Align(
                    alignment: Alignment.center,
                    child: Text(
                      "提示",
                      style: TextStyle(
                        fontSize: 16,
                        fontWeight: FontWeight.w500,
                        color: Colors.white,
                      ),
                    ),
                  ),
                  Align(
                    alignment: Alignment.centerRight,
                    child: CupertinoButton(
                      onPressed: () {
                        // widget.onConfirm();
                      },
                      minSize: 0,
                      padding: EdgeInsets.zero,
                      child: Row(
                        mainAxisSize: MainAxisSize.min,
                        children: [
                          Image.asset(
                            "assets/images/ic_doufeng_tacit_end.png",
                            width: 12,
                            height: 12,
                            fit: BoxFit.contain,
                          ),
                          const SizedBox(
                            width: 5,
                          ),
                          const Text(
                            "结束",
                            style: TextStyle(
                              fontSize: 12,
                              fontWeight: FontWeight.w400,
                              color: Colors.white,
                            ),
                          )
                        ],
                      ),
                    ),
                  ),
                ],
              ),
            ),
            const SizedBox(height: 22),
            const Text(
              "即将进入缘分测试环节\n请您集中注意力\n在规定时间内迅速读题并作答",
              style: TextStyle(
                fontSize: 14,
                fontWeight: FontWeight.w500,
                color: Colors.white,
              ),
              textAlign: TextAlign.center,
            ),
            const SizedBox(
              height: 24,
            ),
            SizedBox(
              width: 50,
              height: 50,
              child: CustomPaint(
                  painter: TacitCountDownPainter(
                width: 50,
                borderWidth: 7,
                factor: model.getAnimationController(this),
              )),
            ),
          ],
        ),
      );
    });
  }
}
